package cn.zxhysy.booksmall.service.impl;

import cn.zxhysy.booksmall.entity.ProLine;
import cn.zxhysy.booksmall.entity.ProductOrder;
import cn.zxhysy.booksmall.mapper.ProductOrderMapper;
import cn.zxhysy.booksmall.service.ProductOrderService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

@Service
public class ProductOrderServiceImpl implements ProductOrderService {
    private final ProductOrderMapper productOrderMapper;

    public ProductOrderServiceImpl(ProductOrderMapper productOrderMapper) {
        this.productOrderMapper = productOrderMapper;
    }

    @Override
    public List<ProductOrder> findAll(String concreteName) {
        Example example = new Example(ProductOrder.class);
        Example.Criteria criteria = example.createCriteria();
        if (StringUtils.isNoneBlank(concreteName)) {
            criteria.andEqualTo("concreteName", concreteName);
        }
        return productOrderMapper.selectByExample(example);
    }
}
